var infor = {
    // 控制左侧菜单栏高度
    fn_height: function() {
        var _height = $('.side-right').outerHeight(true) + 56;
        $('.side-left').height(_height)
    },
    // 下拉列表
    fn_dropdown: function() {
        $(document).on('click', '.basic-section-dropdown input,.icon-dropdown-arrow', function(e) {
            e.stopPropagation()
            $(this).siblings('.dropdown-list').toggle()
        })
        $(document).on('click', function() {
            $('.dropdown-list').hide()
        })
        $(document).on('click', '.dropdown-list li', function() {
            var text = $.trim($(this).html())
            $(this).parents('.basic-section-dropdown').find('input').val(text)
        })
    },
    // 保存
    fn_save: function() {
        $(document).on('click', '.ptitle .save', function() {
            $(this).html('管理').addClass('manage').removeClass('save').parents('.infor-wrap').find('.borderinput').addClass('readonly-active').attr('readonly', 'true').attr('unselectable','on')
            $(this).parents('.infor-wrap').find('.icon-dropdown-arrow,.basic-section-yzm').hide()
            $(this).parents('.infor-wrap').find('.basic-section-dropdown-control').removeClass('basic-section-dropdown')

            $(this).parents('.infor-wrap').find('.basic-section-hide').show()
        })
        $(document).on('click', '.ptitle .manage', function() {
            $(this).html('保存').addClass('save').removeClass('manage').parents('.infor-wrap').find('.borderinput').removeClass('readonly-active').removeAttr('readonly').removeAttr('unselectable')
            $(this).parents('.infor-wrap').find('.icon-dropdown-arrow,.basic-section-yzm').show()
            $(this).parents('.infor-wrap').find('.basic-section-dropdown-control').addClass('basic-section-dropdown')

            $(this).parents('.infor-wrap').find('.basic-section-hide').hide()

        })
    },
    // 获取验证码
    fn_yzm: function(sign,aim) {
        var sign = 1;
        $(document).on('click',aim, function() {
            if (sign == 1) {
                sign = 0;
                var num = 30;
                var that = $(this)
                $(this).css('background', '#c8cbcf')
                $(this).html('重新获取（' + num + '）S')
                var timer = setInterval(function() {
                    num--;
                    if (num == 0) {
                        sign = 1;
                        clearInterval(timer);
                        that.css('background', '#6aa1e6')
                        that.html('获取验证码')
                    } else {
                        sign = 0
                        that.css('background', '#c8cbcf')
                        that.html('重新获取（' + num + '）S')
                    }
                }, 1000)

            }
        })
    },
    // 基本信息验证码
    fn_basic_yzm:function(){
        this.fn_yzm('flag_basic','.bt-basic-yzm');
    },
     // 企业信息验证码
    fn_company_yzm:function(){
        this.fn_yzm('flag_company','.bt-company-yzm');
    },
    init: function() {
        this.fn_height();
        this.fn_dropdown();
        this.fn_save();
        this.fn_basic_yzm();
        this.fn_company_yzm();

       
    }
}
infor.init();